package cn.linlane.entity.sys;


import cn.linlane.entity.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Set;

@Entity
@Getter
@Setter
@Table(name = "sys_role")
@Where(clause = " is_delete = false")
public class SysRole extends BaseEntity {

    @Column(name = "role_name")
    @ApiModelProperty(value = "角色英文简写名称")
    private String roleName;

    @Column(name = "name")
    @ApiModelProperty(value = "中文角色名称（展示）")
    private String name;

    @Column(name = "is_enabled")
    @ApiModelProperty(value = "false: 禁用 true: 可用")
    private boolean isEnabled = true;

    @JsonIgnore
    @ManyToMany(mappedBy = "sysRoles")
    private Set<SysUser> sysUsers;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "sys_role_auth")
    private Set<SysAuth> sysAuths;


}
